<xsl:stylesheet version="2.0" xmlns:foo="http://something" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml">

	<xsl:import href="/apps/engine/utils/translate_fct.xsl"/>

	<xsl:template match="/">
		<xhtml:html>
			<xhtml:head>
				<xhtml:title>
					<xsl:value-of select="/data/appname"/> Login</xhtml:title>
					<xhtml:link rel="stylesheet" type="text/css" href="/views/cssadds/orbeon-forms.css" />
				<xforms:model>
					<xforms:instance id="login">
						<user xmlns="">
							<username/>
							<password/>
						</user>
					</xforms:instance>
<xforms:instance id="data" src="input:data"/>

					<xforms:submission id="main-submission" method="post"
                action="/login" replace="all"/>
				</xforms:model>
			</xhtml:head>
			<xhtml:body>
				<xsl:variable name="dict" select="/data/translation"/>
				<xhtml:div id="authForm">
					<xforms:group ref="/user">
						<xhtml:fieldset>
							<xhtml:legend>Portal Login</xhtml:legend>
							<xsl:if test="/data/error != ''">
								<xhtml:div id="error">
									<xsl:value-of select="foo:translate(/data/error, $dict)"/>
								</xhtml:div>
							</xsl:if>
							<xsl:if test="/data/message != ''">
								<xhtml:div id="message">
									<xsl:value-of select="foo:translate(/data/message, $dict)"/>
								</xhtml:div>
							</xsl:if>
							<xhtml:div class="form_line">
								<xforms:input ref="username">
									<xforms:label>
										<xsl:value-of select="foo:translate('Username', $dict)"/>
									</xforms:label>
								</xforms:input>
							</xhtml:div>
							<xhtml:div class="form_line">
								<xforms:secret ref="password">
									<xforms:label>
										<xsl:value-of select="foo:translate('Password', $dict)"/>
									</xforms:label>
								</xforms:secret>
							</xhtml:div>
							<xhtml:div class="submit">
								<xforms:submit submission="main-submission">
									<xforms:label>
										<xsl:value-of select="foo:translate('Login', $dict)"/>
									</xforms:label>
								</xforms:submit>
								<xforms:trigger>
									<xforms:label>
										<xsl:value-of select="foo:translate('Reset', $dict)"/>
									</xforms:label>
									<xforms:action xmlns:ns1="http://www.w3.org/2001/xml-events" ns1:event="DOMActivate">
										<xforms:setvalue ref="/user/username"/>
										<xforms:setvalue ref="/user/password"/>
									</xforms:action>
								</xforms:trigger>
							</xhtml:div>
						</xhtml:fieldset>
					</xforms:group>
					<xhtml:div id="createAccount">
						<h2>
							<xsl:value-of select="foo:translate('Not registered yet ?', $dict)"/>
						</h2>
						<xsl:value-of select="foo:translate('Create your own user account and try it by yourself !', $dict)"/>
						<xsl:text>
						</xsl:text>
						<xhtml:a href="/register">
							<xsl:value-of select="foo:translate('Register !', $dict)"/>
						</xhtml:a>
					</xhtml:div>
				</xhtml:div>
			</xhtml:body>
		</xhtml:html>
	</xsl:template>
</xsl:stylesheet>